<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}

    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">


    <link rel="stylesheet" href="__STATIC_URL__/static/css/addmchat.css"/>
    <link rel="stylesheet" href="__STATIC_URL__/static/css/creatcard.css"/>
    <link rel="stylesheet" href="__STATIC_URL__/static/css/coupon.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/cardinfo.css"/>


    <style>
        .filePicker{
            margin-top: -5px;
            width: 150px;
            height: 44px;
            background: #00A2D4;
            color: #fff;
            text-align: center;
            line-height: 44px;
            border-radius: 4px;
            cursor: pointer;
        }
        .file{
            position: absolute;
            left: 14px;
            top: -5px;
            width: 150px;
            height: 44px;
            line-height: 44px;
            opacity: 0;
            cursor: pointer;
        }
        .img-file{
            width: 100px;
            height: 100px;
            display: block;
            margin-left: 26px;
            margin-top: 10px;
            display: none;
        }
        .form-control{
            width: 100%;
        }
        .has-switch span, .has-switch label{
            height: auto;
        }
        .color-list li.selected {
            border: 2px solid #FF0000;
            margin: 3px;
            padding: 10px;
        }
        .color-list li {
            width: 20px;
            height: 20px;
            float: left;
            margin: 5px;
            cursor: pointer;
            list-style: none;
        }
        .ng-scope input {
            width: 82px;
            height: 34px;
            position: absolute;
            left: 0;
            top: 0;
            opacity: 0;
            cursor: pointer;
        }
        .card-left{
            position: absolute;
            width: 360px;
            min-height: 625px;
            margin-right: 16px;
            padding-bottom: 10px;
            overflow: hidden;
            border: 1px solid #e7e7eb;
            background-color: #F6F6F8;
            color: #222;
            transition: margin-top .1s;
        }
        .SildeAreaTitle {
            height: 45px;
            line-height: 45px;
            background: #ffffff;
            font-weight: 400;
            padding-left: 15px;
            box-sizing: border-box;
            border: 1px solid #ededed;
            font-size: 13px;
            color: #666;
        }
        .areaShowHide {
            float: right;
            cursor: pointer;
            color: #2db7f5;
            margin-right: 24px;
            line-height: 45px;
        }
        .card_info_box {
            border: 1px solid rgb(237, 237, 237);
            border-top: none;
            background: rgb(255, 255, 255);
            padding-top: 15px;
            display: block;
        }
        code {
            color: #5d9cec;
            background-color: #f4f8fb;
            border-radius: 4px;
        }
        .ant-upload.ant-upload-select-picture-card {
            border: 1px dashed #d9d9d9;
            height: 150px;
            width: 260px;
            padding:0;

        }
        .img{
            display:inline-block;
            height: 100%;
            width: 100%;
            background-repeat: no-repeat;
            background-size: cover;
            background-position: center;
        }
        .ant-upload-list-item-info{
            height: 150px;
            width: 260px;
        }
        .ant-upload-list-item-info:hover:before {
            opacity: .8;
            background-color: gray;
        }
        .ant-upload-list-item-info:before {
            content: " ";
            position: absolute;
            z-index: 1;
            opacity: 0;
            width: 100%;
            height: 100%;
            border-radius: 6px;
        }
        .card-left {

            border:none;
            background-color:#fff;

        }
        .card_section {
            padding: 0;
            color: #363636;
        }
        .upImage{
            position: relative;
        }
        .deluplod {
            cursor: pointer;
            display: inline-block;
            position: absolute;
            color: #fff;
            width: 45px;
            right: -3px;
            top: 2px;
        }
        .coupon-time{
            float:initial;
            display: inline-block;
        }
        .coupon-times{
            float:initial;
            display: inline-block;
        }
        .dropdown_menu {
            vertical-align: middle;

        }

        .dropdown_menu {
            display: inline-block;
            *display: inline;
            *zoom: 1;
            position: relative;

            line-height: normal;
            text-align: left;

        }
    </style>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li>
                    <a href="{:url('cards/cardslist')}">卡券管理</a>
                </li>
                <li>
                    <a href="javascript:history.back();">卡券列表</a>
                </li>
                <li class="active" style="color: #02b87f;">添加卡券</li>
            </ul>
        </div>
        {if condition="$info['errmsg'] neq '' "}
        <div class="alert alert-warning mgr15 mgl15">
            <a href="#" class="close" data-dismiss="alert">
                &times;
            </a>
            <strong>{$info['errmsg']}</strong>
        </div>
        {/if}
        <div class="panel mgr15 mgl15">

            <div class="panel-heading addCharts" style="background:#ededed;">
                卡券
            </div>
            <div class="panel-body">

                <div class="panel panel-default" id="step1">
                    <div class="panel-body">

                        <div class="card_preview_area card-left" >
                            <div class="media_preview_area" id="js_preview_area">
                                <div class="msg_card js_color_preview card_section" style=" background-color: {:getcolor($info['color'])}; ">
                                    <div class="msg_card_inner js_color_preview card_section" style=" background-color: {:getcolor($info['color'])}; ">
                                        <p class="msg_title js_color_preview " style="margin: 0px;"></p>
                                        <div class="js_preview js_color_preview msg_card_section shop disabled focus itemdiv card_section" style=" background-color: {:getcolor($info['color'])};">

                                            <div class="shop_panel" id="color-purview" style=" height: auto; margin-bottom: -15px; ">
                                                <div class="logo_area group">
                                        <span class="logo l" id="logo">
                                            <img src="{$info['logo_url']}" class="logopic" style="margin:0;">
                                        </span>
                                                    <br>
                                                    <p id="brand_name_preview" class="js_title_preview brand_name">{$info['brand_name']}</p>
                                                </div>
                                                <div class="msg_area">
                                                    <div class="tick_msg">


                                                        <p id="js_title_preview" class="kqmc card_name">{$info['title']}</p>
                                                        <p id="sub_title_preview" class="cardtips"></p>
                                                        <p class="ljsy" style="background-color:{:getcolor($info['color'])};border-radius: 3px;color: #fff;padding: 8px 35px;width: 50%;margin: 0 auto;">
                                                            立即使用

                                                        </p>


                                                        <div class="clear"></div>
                                                    </div>
                                                    <!--<p class="time cardtips" id="invalidshow" style>-->
                                                    <!--<span id="js_time_preview">-->
                                                    <!--有效期：-->
                                                    <!--<span class="time1" id="time1"></span>-<span id="time2" class="time2"></span>-->
                                                    <!--</span>-->
                                                    <!--</p>-->
                                                </div>

                                            </div>

                                            <!--<div class="card_usage">-->
                                            <!--<ul>-->
                                            <!--<li>-->
                                            <!--<span class="usage_label">-->
                                            <!--可用时间：-->

                                            <!--<span class="usage_text">2018.06.08-2018.08.25</span>-->
                                            <!--</span>-->
                                            <!--<span id="js_use_time_preview"></span>-->
                                            <!--<span id="js_time_limit_preview" style="display: inline-block;"></span>-->
                                            <!--</li>-->
                                            <!--</ul>-->
                                            <!--</div>-->
                                            <div class="fengmian_img_parent hide" style="position: relative;padding-bottom: 0px;">
                                                <img src="{$info['icon_url_list']}" style="width: 100%;height: 125px;" class="fengmian_img_dom">
                                                <div id="cover-pre">

                                                    <span id="cover-text" class="coverAbstract">{if condition="$info['advanced_info']['abstract']['abstract'] eq '' "}默认查看更多{/if}{$info['advanced_info']['abstract']['abstract']}</span>

                                                    <i class="ion-ios7-arrow-right"></i>
                                                </div>
                                            </div>
                                            <div class="msg_card_cell shop_detail last_cell">
                                                <ul class="list">
                                                    <li class="msg_card_section js_preview give-friend-pre hide" id="quick_pay">
                                                        <div class="li-panel area">
                                                            <div class="li_content"><p>转赠给朋友</p></div>
                                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                                            <div class="cicon">
                                                                <a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
                                                            </div>
                                                        </div>
                                                    </li>
                                                    <li>
                                                        <div class="li-panel area">
                                                            <div class="li-content"id="card">代金券详情</div>
                                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                                            <div class="cicon">
                                                                <a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
                                                            </div>
                                                        </div>
                                                    </li>
                                                    <li>
                                                        <div class="li-panel area ">
                                                            <div class="li-content">公众号</div>
                                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                                            <div class="cicon">
                                                                <a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
                                                            </div>
                                                        </div>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>







                        <div class="pull-left card-left hide" >
                            <div class="card_section area" style="position: relative;background-color:{:getcolor($info['color'])};">
                                <div class="shop-panel" id="color-purview" style="position:relative;height:180px;background-size: cover;border-radius:0px;background: #fff;">
                                    <div class="logo-area">
                                        <div class="logo"  style="text-align: center;width: 100%;height: auto;border:0;margin: 0">
                                            <img src="{$info['logo_url']}" class="logopic" style="margin:0;border: #dedede solid 1px;">
                                        </div>
                                        <div class="cardname" style="text-align: center;padding: 10px">
                                            <p class="brand_name" style="margin-top: 50px;color: #000;">{$info['brand_name']}</p>
                                            <p style="font-size:18px;color: #000;" class="kqmc">{$info['title']}</p>
                                            <p style="background-color:{:getcolor($info['color'])};padding: 5px 10px;border-radius: 5px;color: #fff;" class="ljsy"><span>立即使用</span></p>
                                        </div>

                                        <div class="clear"></div>
                                    </div>
                                    <div class="msg-area">

                                    </div>
                                    <div class="chakandetail">

                                    </div>
                                </div>

                            </div>
                            <div class="shop-detail">
                                <ul class="list">
                                    <li class="quick_pay hide" id="quick_pay">
                                        <div class="li-panel area">
                                            <input type="hidden" value="{$info['base_info']['can_give_friend']}" id="friend">
                                            <div class="li-content">转赠给朋友</div>
                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                            <div class="cicon">
                                                <a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
                                            </div>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="li-panel area">
                                            <div class="li-content"id="card">{:getcardtype($info['card_type'])}详情</div>
                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                            <div class="cicon">
                                                <a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
                                            </div>
                                        </div>
                                    </li>
                                    <li>
                                        <div class="li-panel area">
                                            <div class="li-content">公众号</div>
                                            <span class="ricon glyphicon glyphicon-chevron-right"></span>
                                            <div class="cicon">
                                                <a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
                                            </div>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="alert form form-area" style="position: relative;margin-left:370px;display: block; margin-top: 0.5px;" id="form1">
                            <div class="arrow_in"></div>
                            <h4  class="card_title_detail">基本信息</h4>
                            <div class="form-horizontal form-group">
                                <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 卡券类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="btn-group" id="quan-type">
                                    <input type="hidden" id="card_type" value="{$info['card_type']}">
                                    <button class="btn btn-default {if condition="$info['card_type'] eq 'CASH' "}active{/if}" data-id="1">代金券</button>
                                    <button class="btn btn-default {if condition="$info['card_type'] eq 'DISCOUNT' "}active{/if}" data-id="2">折扣券</button>
                                    <button class="btn btn-default {if condition="$info['card_type'] eq 'GIFT' "}active{/if}" data-id="3">兑换券</button>
                                    <button class="btn btn-default {if condition="$info['card_type'] eq 'GENERAL_COUPON' "}active{/if}" data-id="4">优惠券</button>
                                    <button class="btn btn-default {if condition="$info['card_type'] eq 'GROUPON' "}active{/if}" data-id="5">团购券</button>
                                </div>
                            </div>
                            <form class="form-horizontal adminex-form" action="" id="creatcard" method="post">
                                <input type="hidden" name="mid" value="">
                                <input type="hidden" name="brand_name" value="">
                                <input type="hidden" name="logourl" value="">
                                <input type="hidden" name="service_phone" value="">
                                <input type="hidden" name="type" id="type" value="1">
                                <input type="hidden" name="is_card_xs" value="2">
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-9 col-xs-12">
                                        <select name="mid" class="form-control" id="mid"  onchange="subid(this);">

                                            {volist name="mach" id="mach"}
                                            <option  {if condition="$info['mid'] eq $mach.id "}selected{/if} value="{$mach['id']}"  data-sub="{$mach['sub_mch_id']}" >{$mach['merchant']}</option>
                                            {/volist}
                                        </select>
                                        <div class="text-danger">只显示已授权微信公众号的门店</div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">卡券名称：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-9 col-xs-12">
                                        <input type="text" class="form-control" name="title" id="kqmc"  oninput="binding('kqmc','卡券名称')" value="{$info['title']}" onchange="tex('kqmc','titletext','9');">
                                        <div class="help-block" id="titletext"></div>
                                        <div class="help-block">例如：5元代金券 ,字数上限为9个汉字。</div>
                                    </div>
                                </div>



                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">
                                        背景颜色：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span>
                                    </label>
                                    <div class="col-sm-9 col-xs-12">
                                        <div class="cover" id="colors">
                                            <input type="hidden" name="color" value="{:getcolor($info['color'])}" >
                                            <ul class="color-list clearfix">
                                                <li {if condition="getcolor($info['color']) eq '#63b359'"} class="selected" {/if} style="background-color:#63b359;" data-color="#63b359"></li>
                                                <li {if condition="getcolor($info['color']) eq '#2c9f67'"} class="selected" {/if} style="background-color:#2c9f67;" data-color="#2c9f67"></li>
                                                <li {if condition="getcolor($info['color']) eq '#509fc9'"} class="selected" {/if} style="background-color:#509fc9;" data-color="#509fc9"></li>
                                                <li {if condition="getcolor($info['color']) eq '#5885cf'"} class="selected" {/if} style="background-color:#5885cf;" data-color="#5885cf"></li>
                                                <li {if condition="getcolor($info['color']) eq '#9062c0'"} class="selected" {/if} style="background-color:#9062c0;" data-color="#9062c0"></li>
                                                <li {if condition="getcolor($info['color']) eq '#d09a45'"} class="selected" {/if} style="background-color:#d09a45;" data-color="#d09a45"></li>
                                                <li {if condition="getcolor($info['color']) eq '#e4b138'"} class="selected" {/if} style="background-color:#e4b138;" data-color="#e4b138"></li>
                                                <li {if condition="getcolor($info['color']) eq '#ee903c'"} class="selected" {/if} style="background-color:#ee903c;" data-color="#ee903c"></li>
                                                <li {if condition="getcolor($info['color']) eq '#f08500'"} class="selected" {/if} style="background-color:#f08500;" data-color="#f08500"></li>
                                                <li {if condition="getcolor($info['color']) eq '#a9d92d'"} class="selected" {/if} style="background-color:#a9d92d;" data-color="#a9d92d"></li>
                                                <li {if condition="getcolor($info['color']) eq '#dd6549'"} class="selected" {/if} style="background-color:#dd6549;" data-color="#dd6549"></li>
                                                <li {if condition="getcolor($info['color']) eq '#cc463d'"} class="selected" {/if} style="background-color:#cc463d;" data-color="#cc463d"></li>
                                                <li {if condition="getcolor($info['color']) eq '#cf3e36'"} class="selected" {/if} style="background-color:#cf3e36;" data-color="#cf3e36"></li>
                                                <li {if condition="getcolor($info['color']) eq '#5E6671'"} class="selected" {/if} style="background-color:#5E6671" data-color="#5E6671"></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group hidden" id="hurry_wrap">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">开启立减金额：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <div class="controls">
                                            <div class="switch" id="hurry">
                                                <input type="checkbox" {if condition="$info['is_minus'] eq '1' "}checked{/if}/>
                                                <input type="hidden" name="is_minus" id="can_hurry" value="{$info['is_minus']}">
                                            </div>
                                            <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">
                                                开启后请前往营销工具，社交立减金中设置。
                                                <br>
                                                开启后下方开始时间必须大于当前时间。
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group {if condition="$info['is_minus'] eq '1' "} {else/}hidden{/if}" id="create_mid_wrap">
                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">商户号：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" name="create_mid" placeholder=""  id="create_mid" value="{$info['create_mid']}">
                                    <div class="help-block">输入已配置appid的微信支付商户号。 </div>
                                </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否为付费：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="controls">
                                    <div class="switch" id="pay">
                                        <input type="checkbox" {if condition="$info['is_pay'] eq '1' "}checked{/if}/>
                                        <input type="hidden" name="is_pay" id="is_pay" value="{$info['is_pay']}">
                                    </div>
                                    <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">开启后可在营销工具,付费卷中设置。  </div>

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否参与充送：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="controls">
                                    <div class="switch" id="cgive">
                                        <input type="checkbox" {if condition="$info['is_cgive'] eq '1' "}checked{/if}/>
                                        <input type="hidden" name="is_cgive" id="is_cgive" value="{$info['is_cgive']}">
                                    </div>
                                    <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">开启后可在会员卡,储值管理,添加面额中设置。  </div>

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否可分享：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="controls">
                                    <div class="switch" id="share">
                                        <input type="checkbox" {if condition="$info['base_info']['can_share'] eq '1' "}checked{/if}/>
                                        <input type="hidden" name="can_share" id="can_share" value="{$info['base_info']['can_share']}">
                                    </div>
                                    <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">开启后可在手机微信端卡券里分享。  </div>

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否可转赠：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="controls">
                                    <div class="switch" id="give">
                                        <input type="checkbox" {if condition="$info['base_info']['can_give_friend'] eq '1' "}checked{/if}/>
                                        <input type="hidden" name="can_give_friend" id="can_give_friend" value="{$info['base_info']['can_give_friend']}">


                                    </div>
                                    <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">开启后可在手机微信端卡券里转送。  </div>
                                </div>
                            </div>
                        </div>
                        <!--<div class="form-group">-->
                        <!--<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否在卡券中心显示：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>-->
                        <!--<div class="col-sm-9 col-xs-12">-->
                        <!--<select name="is_card_xs" class="form-control" >-->
                        <!--<option value="2">隐藏</option>-->
                        <!--<option value="1">显示</option>-->
                        <!--</select>-->
                        <!--<div class="text-danger"></div>-->
                        <!--</div>-->
                        <!--</div>-->

                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">领取限制：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="clearfix">
                                    <input type="text"  class="form-control pull-left" name="get_limit" id="get_limit" style="width: 200px;" value="{$info['base_info']['get_limit']}">
                                    <span class="pull-left" style="padding-top:4px">张</span>
                                </div>
                                <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">每人可领取的数量限制，建议每人限领一张  </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">使用限制：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="clearfix">
                                    <input type="text" value="{$info['base_info']['use_limit']}" class="form-control pull-left" name="use_limit" id="use_limit" style="width: 200px;" >
                                    <span class="pull-left" style="padding-top:4px">张</span>
                                </div>
                                <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">每人可使用的数量，建议每人限用一张（使用限制推荐等于领取限制）  </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">有效期：<span
                                    class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">
                                            <span class="radio ng-scope radio-inline" onclick="settimes(this,'date_info');">
                                                     <input name="date_info" type="radio" {if condition="$info['time_type'] eq 'DATE_TYPE_FIX_TIME_RANGE' "}checked{/if}  value="DATE_TYPE_FIX_TIME_RANGE">
                                                     <label class="ng-binding">固定日期</label>
                                            </span>
                                    </label>
                                    <div class="col-sm-6 col-xs-6 coupon-time">
                                        <input type="text" name="times"  class="form-control" value="{$info['times']}" placeholder="请选择开始时间" readonly="readonly" id="starttime">
                                        <div class="r-message text-danger"></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">

                                            <span class="radio ng-scope radio-inline"  onclick="settimes(this,'date_info');">
                                                      <input name="date_info" type="radio"  value="DATE_TYPE_FIX_TERM" {if condition="$info['time_type'] eq 'DATE_TYPE_FIX_TERM' "}checked{/if}>
                                                      <label class="ng-binding">领取后，</label>
                                            </span>
                                    </label>

                                    <span class="dropdown_menu">
                                                <select class="form-control pull-left" name="fixed_begin_term"
                                                        id="fixed_begin_term">
                                                    <option value="0" >当天</option>
                                                    {for start="1" end="91"}
                                                    <option value="{$i}" {if condition="$info['fixed_begin_term'] eq $i "}selected{/if}>{$i}天</option>
                                                    {/for}
                                                </select>
                                            </span>
                                    <span class="dropdown_menu" style="padding-top:4px">生效</span>
                                    <span class="dropdown_menu" style="padding-top:4px">，有效天数</span>

                                    <span class="dropdown_menu">
                                                <select class="form-control pull-left" name="fixed_term"
                                                        id="fixed_term">
                                                    {for start="1" end="91"}
                                                    <option value="{$i}" {if condition="$info['fixed_term'] eq $i "}selected{/if}>{$i}天</option>
                                                    {/for}
                                                </select>
                                            </span>

                                    <span class="dropdown_menu">
                                                <input type="text" class="form-control pull-left" name='end_timestamp'
                                                       placeholder="统一过期时间" id="end_timestamp" value="{$info['end_timestamp']|date='Y-m-d H:i:s',###}">
                                            </span>
                                    <span class="" style="padding-top:4px">日统一过期</span>

                                </div>

                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">库存：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <input type="text"class="form-control" name="quantity"  id="quantity" value="{$info['base_info']['sku']['quantity']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">使用提醒：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <input type="text" class="form-control" name="notice" id="notice" value="{$info['base_info']['notice']}" onchange="tex('notice','titleCount','18');">
                                <div class="help-block" id="titleCount"> </div>
                                <div class="help-block">使用提醒,字数上限为18个汉字。 </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">使用说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                            <div class="col-sm-9 col-xs-12 coupon-color">
                                <input type="text" class="form-control" name="description"  id="description" value="{$info['base_info']['description']}" onchange="tex('description','desCount','1024');">

                                <div class="help-block" id="desCount"> </div>
                                <div class="help-block">使用说明,字数上限为1024个汉字。 </div>
                            </div>

                        </div>

                        <h4  class="card_title_detail">优惠详情</h4>
                        <div id="yh-jieshao" class="hide yh-type">
                            <div class="form-group">
                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">卡券优惠详情：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-9 col-xs-12" style="padding-top: 6px;">
                                    <input type="hidden" value="{$info['gift']}" id="gift">
                                    <input type="hidden" value="{$info['default_detail']}" id="default_detail">
                                    <input type="hidden" value="{$info['deal_detail']}" id="deal_detail">
                                    <textarea name="conten" id="conten" class="s" placeholder="填写优惠具体信息" style="width: 100%;height: 100px;padding: 10px;" ></textarea>
                                </div>
                            </div>
                        </div>
                        <div id="yh-money" class="yh-type hide" >
                            <div class="form-group">
                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">起用金额：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-9 col-xs-12 coupon-color">
                                    <input type="text" class="form-control s" name="least_cost"  id="least_cost" value="{$info['least_cost']}" >
                                    <div class="help-block col-sm-12 col-xs-12" style="padding: 0;">例：满10(起用金额)减1(减免金额)。  </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">减免金额：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-9 col-xs-12 coupon-color">
                                    <input type="text" class="form-control s" name="reduce_cost"  id="reduce_cost" value="{$info['reduce_cost']}">
                                    <div class="help-block">减免金额必须小于 起用金额。 </div>

                                </div>
                            </div>
                        </div>


                        <div  class=" form-group m-bt-0">
                            <div  class="SildeAreaTitle">系统已为您完成优惠券其他基础信息设置
                                <p class="areaShowHide">
                                    <span >展开</span>
                                    <i class=" glyphicon glyphicon-chevron-up"></i>
                                </p>
                            </div>
                            <div class="card_info_box"style="display: none;">

                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商家名称：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-9 col-xs-12">
                                        <input type="text" class="form-control" name="brand_name" id="brand_name"   value="{$info['brand_name']}"  oninput="binding('brand_name','商家名称')">
                                        <div class="help-block" id="brand"> </div>
                                        <div class="help-block">商家名称,字数上限为12个汉字。 </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">卡券LOGO：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <div class="ng-scope" style="position: relative;">
                                            <span class="btn btn-default">上传LOGO</span>
                                            <input type="file" id="logopic" value=""  onchange="upload('logopic', 'file')" />
                                            <input type="hidden" name="logo_url" id="logo_url" value="{$info['logo_url']}">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">客服电话：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control" name="service_phone" id="service_phone" value="{$info['base_info']['service_phone']}" >
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">封面摘要：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control" name="advanced_info[abstract][abstract]" id="coverAbstract"   value="{$info['advanced_info']['abstract']['abstract']}"  placeholder="券封面摘要，配合图片写些营销文案，来吸引消费者" style="width: 80%;" onclick="binding('coverAbstract','查看详情')" onchange="tex('coverAbstract','coverAbstracttext','9');">

                                        <div class="help-block" id="coverAbstracttext"> </div>
                                        <p class="tipsInfo"> 封面摘要,字数上限为9个汉字</p>

                                    </div>
                                </div>
                                <div class="form-horizontal" data-layout="horizontal">
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">封面图片：</label>
                                        <div class="col-sm-9">
                                            <div class="ant-upload ant-upload-select ant-upload-select-picture-card ">

                                                <div class="ant-upload-list-item-info" style="display:none;" id="fimg">
                                                    <div class="ant-upload ant-upload-select ant-upload-select-picture-card upload-v-img">
                                                        <img src="{$info['icon_url_list']}" alt="" class="img">
                                                        <i class="icon-close anticon-delete coverImgDel glyphicon glyphicon-remove-circle" data-ref="v-img-file" style=" left: 44%; "></i>

                                                    </div>
                                                </div>
                                            </div>
                                            <div class="ng-scope" style="position: relative;">
                                                <span class="btn btn-default">上传图片</span>
                                                <input type="file" id="img" value=""  onchange="uploads('img','file','fimg')"/>
                                                <input type="hidden" name="advanced_info[abstract][icon_url_list]" id="logopic-upload" required  value="{$info['icon_url_list']}" >

                                            </div>
                                            <p class="tipsInfo"> 非必填项，图片进行适当设计，建议尺寸850px*350px，选择与券内容相关的图片，仅支持JPG、JPEG、PNG图片文件，且文件小于2M</p>
                                        </div>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div class="form-group">
                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">图文介绍：</label>


                                        <div class="col-sm-9 ">
                                            <p class="tipsInfo"> 非必填项，图片进行适当设计，建议尺寸850px*350px，选择与券内容相关的图片，仅支持JPG、JPEG、PNG图片文件，且文件小于2M</p>

                                            <div class="frm_controls frm_vertical_lh">

                                                <div class="brand_item">
                                                    <div id="imgtuwen">
                                                        {volist name="info.advanced_info.text_image_list" id="vo" key="key"}
                                                        <div class="imagetxts">
                                                            <div class="ant-upload-list-item-info" {if condition="$vo['image_url'] eq '' "} style="display:none;"{/if}  >
                                                            <img src="{$vo['image_url']}" class="imageShow">
                                                            <i class="icon-close anticon-delete imgTxtDel glyphicon glyphicon-remove-circle"></i>
                                                        </div>
                                                        <div>
                                                            <input type="hidden" value class="cardTextImages_id valid" tip-idx>
                                                            <input type="hidden" value class="wechatImage valid" tip-idx>
                                                            <input type="hidden" name="advanced_info[text_image_list][image_url][]" value="{$vo['image_url']}" class="image valid" >
                                                            <input type="file" class="imageTxtFile valid" value style="display:none;" >
                                                        </div>
                                                        <div class="upImage">
                                                            <i class="icon-picture"></i>
                                                            上传图片
                                                            <div class="deluplod" {if condition="$key eq '1' "} style="display:none;"{/if}>
                                                            <i class="icon-close glyphicon glyphicon-remove-circle"></i>
                                                        </div>
                                                    </div>
                                                    <div>
                                                        <textarea class="imageTxt-txt form-control valid" name="advanced_info[text_image_list][text][]" placeholder="图文内容建议上传商品、服务、环境等优质图片，并辅之以简单描述" maxlength="170"  style=" width: 370px;">{$vo['text']}</textarea>
                                                    </div>


                                                </div>
                                                {/volist}
                                            </div>
                                            <div class="adduplod addImageTxt">
                                                添加图文
                                            </div>
                                        </div>



                                    </div>

                                </div>
                            </div>
                        </div>

                    </div>
                </div>


                <div id="yh-discount" class="yh-type hide">
                    <div class="form-group">
                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">折扣：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                        <div class="col-sm-9 col-xs-12 coupon-color">
                            <input type="text" class="form-control s" name="discount" id="discount" placeholder="例如：填70就是七折" value="{$info['discount']}">
                        </div>
                    </div>
                </div>
                <div style="text-align: center">
                    <button type="submit" class="btn btn-primary">保存到草稿箱</button>
                </div>
                </form>
            </div>
        </div>
    </div>
    {include file='public/footer'/}
    </div>
    </div>
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
<script src="__STATIC_URL__/static/js/twcards.js?v=1"></script>
<script>
    $(function(){
        var val="{$info['time_type']}";

        if(val=='DATE_TYPE_FIX_TIME_RANGE'){
            $("#fixed_begin_term").attr("disabled",true);
            $("#fixed_term").attr("disabled",true);
            $("#end_timestamp").attr("disabled",true);

            $("#starttime").attr("disabled",false);

        }else if(val=='DATE_TYPE_FIX_TERM'){
            $("#starttime").attr("disabled",true);
            $("#fixed_begin_term").attr("disabled",false);
            $("#fixed_term").attr("disabled",false);
            $("#end_timestamp").attr("disabled",false);
        }
    })
    function settimes(obj,name){

        var val=$('input[name="date_info"]:checked').val();

        if(val=='DATE_TYPE_FIX_TIME_RANGE'){
            $("#fixed_begin_term").attr("disabled",true);
            $("#fixed_term").attr("disabled",true);
            $("#end_timestamp").attr("disabled",true);

            $("#starttime").attr("disabled",false);

        }else if(val=='DATE_TYPE_FIX_TERM'){
            $("#starttime").attr("disabled",true);
            $("#fixed_begin_term").attr("disabled",false);
            $("#fixed_term").attr("disabled",false);
            $("#end_timestamp").attr("disabled",false);
        }
    }
</script>
<script>
    $(function(){
        var val=$("#logopic-upload").val();
        console.log(22,val);
        if(val=="undefined"||val==""){
            console.log(333,val);

        }else{
            $(".fengmian_img_parent").removeClass("hide")
            $("#fimg").attr("style","display:block")
        }



        $("#imgtuwen").each(function(){
            var src=[];
            var src= $(".imageShow").attr("src");
            console.log(src);
            if(src==""){
                $(this).parent('.ant-upload-list-item-info').attr("style","display:none");
            }
        });

    })
</script>
<script>
    $(function(){
        var val= $("#time_type").val();
        console.log(11,val);
        if(val=="DATE_TYPE_FIX_TERM"){
            $("#cover2").removeClass("hide");
            $("#dis").attr("selected","selected");
        }
        if(val=="DATE_TYPE_FIX_TIME_RANGE"){
            $("#cover1").removeClass("hide");
            $("#cov").attr("selected","selected");
        }
    })
</script>
<script>
    $(function(){
        var card=$("#card_type").val();
        var friend=$("#friend").val();
        var val="";
        if(friend=='1'){
            $("#quick_pay").removeClass("hide");
        }
        switch(card){
            case "CASH":
                val=1;
                break;
            case "DISCOUNT":
                val=2;
                break;
            case "GIFT":
                val=3;
                break;
            case "GENERAL_COUPON":
                val=4;
                break;
            case "GROUPON":
                val=5;
                break;
        }
        console.log(card,val);
        $("#type").val(val);
        if(val==1){
            $("#hurry_wrap").removeClass("hidden");
            $("#yh-money").removeClass("hide");


            $('#card').html("代金券详情");
        }else if(val==2){
            $("#hurry_wrap").addClass("hidden");
            $("#create_mid_wrap").addClass("hidden");
            $("#yh-discount").removeClass("hide");

            $('#card').html("折扣券详情");
        }else if(val==3){
            $("#hurry_wrap").addClass("hidden");
            $("#create_mid_wrap").addClass("hidden");
            $("#yh-jieshao").removeClass("hide");

            $('#card').html("兑换券详情");
            var gift=$("#gift").val();
            $("#conten").val(gift);
        }else if(val==4){
            $("#hurry_wrap").addClass("hidden");
            $("#create_mid_wrap").addClass("hidden");
            $("#yh-jieshao").removeClass("hide");

            $('#card').html("优惠券详情");
            var default_detail=$("#default_detail").val();
            $("#conten").val(default_detail);

        }else if(val==5){
            $("#hurry_wrap").addClass("hidden");
            $("#create_mid_wrap").addClass("hidden");
            $("#yh-jieshao").removeClass("hide");

            var deal_detail=$("#deal_detail").val();
            $("#conten").val(deal_detail);
            $('#card').html("团购券详情");
        }
    })
</script>
<script>

    function tex(idq,tex,num){
        //console.log(idq,tex,num)
        $("#"+tex).text("还可以输入" + (num - $("#"+idq).val().length) + "个字");


        if ( $("#"+idq).val().length > num) {
            $("#"+idq).val( $("#"+idq).val().substring(0, num));
        }
        $("#"+tex).text("还可以输入" + (num -  $("#"+idq).val().length) + "个字");
        var val=$("#"+idq).val();
        //console.log(11,val);
        $("."+idq).html(val)
        $("."+idq).val(val)
    }


</script>

<script>
    function subid(obj){
        var val= $(obj).find("option:selected").attr("data-sub");
        $("#create_mid").val(val);
        console.log(val);
    }
</script>
<script>
    function upload(file) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other',file);
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            $("."+file).attr("src",res.pic);
            $("#logo_url").val(res.pic);
        }).fail(function (res) {
            alert("上传失败")
        });
    }
    //数据绑定
    function binding(id,name){
        var val = $("#"+id).val();
        if(val==""){
            val=name
        }
        $("."+id).text(val)
    }


    $(function () {
//        选取优惠券背景颜色
        $(".color-list li").click(function() {
            $(".color-list li").removeClass("selected");
            $(this).addClass("selected");
            var colors = $(this).attr("data-color");
            $(".card_section").css("background-color", colors);
            $(".ljsy").css("background-color", colors);
            $("input[name='color']").val(colors);
        });
//        选取卡券类型
        $("#quan-type button").click(function(){
            var val = $(this).attr("data-id");
            $("#quan-type button").removeClass("active");
            $(this).addClass("active");
            $("#type").val(val);
            $(".yh-type").addClass("hide");

            if(val==1){
                $("#hurry_wrap").removeClass("hidden");

                $("#hurry_wrap").removeClass("hide")

                $("#yh-money").removeClass("hide")

                $('#card').html("代金券详情");
            }else if(val==2){
                $("#hurry_wrap").addClass("hidden");
                $("#create_mid_wrap").addClass("hidden");
                $("#yh-discount").removeClass("hide");
                $("#dis").removeAttr("disabled");
                $('#card').html("折扣券详情");
            }else if(val==3){
                $("#hurry_wrap").addClass("hidden");
                $("#create_mid_wrap").addClass("hidden");
                $("#yh-jieshao").removeClass("hide");
                $("#dis").removeAttr("disabled");
                $('#card').html("兑换券详情");
            }else if(val==4){
                $("#hurry_wrap").addClass("hidden");
                $("#create_mid_wrap").addClass("hidden");
                $("#yh-jieshao").removeClass("hide");
                $("#dis").removeAttr("disabled");
                $('#card').html("优惠券详情");
            }else if(val==5){
                $("#hurry_wrap").addClass("hidden");
                $("#create_mid_wrap").addClass("hidden");
                $("#yh-jieshao").removeClass("hide");
                $("#dis").removeAttr("disabled");
                $('#card').html("团购券详情");
            }
        });

    });

    $("#hurry").on('switch-change', function (e, data) {
        var $el = $(data.el), value = data.value;
        if(value==true){
            $("#can_hurry").val(1);
            $("#dis").prop("disabled","true");
            $("#create_mid_wrap").removeClass("hidden");

        }else{
            $("#can_hurry").val(0);
            $("#dis").removeAttr("disabled");
            $("#create_mid_wrap").addClass("hidden");
        }
    });
    $("#share").on('switch-change', function (e, data) {
        var $el = $(data.el), value = data.value;
        if(value==true){
            $("#can_share").val(1);
        }else{
            $("#can_share").val(0);
        }
    });
    $("#give").on('switch-change', function (e, data) {
        var $el = $(data.el), value = data.value;
        if(value==true){
            $("#can_give_friend").val(1);
            $("#quick_pay").removeClass("hide");
        }else{
            $("#can_give_friend").val(0);
            $("#quick_pay").addClass("hide");
        }
    });
    $("#pay").on('switch-change', function (e, data) {
        var $el = $(data.el), value = data.value;
        if(value==true){
            $("#is_pay").val(1);
        }else{
            $("#is_pay").val(0);
        }
    });
    $("#cgive").on('switch-change', function (e, data) {
        var $el = $(data.el), value = data.value;
        if(value==true){
            $("#is_cgive").val(1);
        }else{
            $("#is_cgive").val(0);
        }
    });
    $(window).scroll(function() {
        if($(window).scrollTop() > 106) {
            $(".card-left").css({ "position": "fixed", "top": "106px" });
        } else {
            $(".card-left").css({ "position": "absolute", "top": "" });
        }
    });
</script>

<script>

    // 展开隐藏
    $(".areaShowHide").click(function() {

        if($(".card_info_box").is(":hidden")){
            $(".card_info_box").fadeIn();
            $(".areaShowHide").html('<span>收起</span> <i class=" glyphicon glyphicon-chevron-down"></i>');
        }else{
            $(".areaShowHide").html('<span>展开</span> <i class=" glyphicon glyphicon-chevron-up"></i>');
            $(".card_info_box").fadeOut();
        }
        closeTip($(".card_info_box input"));
    });
    function closeTip(element) {
        var tips_index = $(element).attr("tip-idx");
        layer.close(tips_index);
        $(element).attr("tip-idx", "");
        $(element).addClass("valid");
    }
    ////
    $("#cover").change(function() {
        var val = $(this).val();
        $(".cover2").removeClass("show").addClass("hide");
        if(val == 'DATE_TYPE_FIX_TIME_RANGE') {

            $(".cover1").removeClass("hide").addClass("show");
            $(".cover2").removeClass("show").addClass("hide");

        } else if(val == "DATE_TYPE_FIX_TERM") {
            $(".cover1").removeClass("show").addClass("hide");
            $(".cover2").removeClass("hide").addClass("show");

        }
    });
</script>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script>
    // var date = new Date();
    // //执行一个laydate实例
    // laydate.render({
    //     elem: '#starttime'
    //     ,type: 'datetime'
    //     ,range: true
    //     ,min:data
    // });

    var laydate = laydate;
    var date = new Date();
    var year = parseInt(date.getFullYear());
    var month = parseInt(date.getMonth())+1;
    var day = parseInt(date.getDate());
    var H = parseInt(date.getHours());
    var M =parseInt( date.getMinutes());
    var S = parseInt(date.getSeconds());
    if(month<10){
        month = "0"+month;
    }
    if(day<10){
        day = "0"+day;
    }
    var min = year+"-"+month+"-"+day +" "+ H +':'+ M +':'+S;
    console.log(min);
    var date = {
        type: 'datetime',
        min:min,
        range:'-',
        trigger: 'click'
    };
    date.elem = '#starttime';
    //执行一个laydate
    laydate.render(date);

</script>
<script>
    // 添加图文
    $(".addImageTxt").click(function() {
        if ($(".imagetxts").length < 5) {
            var index = $(".imagetxts:last").data("data-index");
            var template = ' <div class="imagetxts">\n' +
                '                                                                <div class="ant-upload-list-item-info" style=" display: none; ">\n' +
                '                                                                    <img src(unknown) class="imageShow">\n' +
                '                                                                    <i class="icon-close anticon-delete imgTxtDel glyphicon glyphicon-remove-circle"></i>\n' +
                '                                                                </div>\n' +
                '                                                                <div>\n' +
                '                                                                    <input type="hidden" value class="cardTextImages_id valid" tip-idx>\n' +
                '                                                                    <input type="hidden" value class="wechatImage valid" tip-idx>\n' +
                '                                                                    <input type="hidden" value name="advanced_info[text_image_list][image_url][]" class="image valid" tip-idx>\n' +
                '                                                                    <input type="file" class="imageTxtFile valid" value="" style="display:none;" tip-idx>\n' +
                '                                                                </div>\n' +
                '                                                                <div class="upImage">\n' +
                '                                                                    <i class="icon-picture"></i>\n' +
                '                                                                     上传图片\n' +
                '                                                                    <div class="deluplod" style="display: none;">\n' +
                '                                                                        <i class="icon-close glyphicon glyphicon-remove-circle"></i>\n' +
                '                                                                    </div>\n' +
                '                                                                </div>\n' +
                '                                                                <div>\n' +
                '                                                                    <textarea class="imageTxt-txt form-control valid" name="advanced_info[text_image_list][text][]" placeholder="图文内容建议上传商品、服务、环境等优质图片，并辅之以简单描述" maxlength="170" tip-idx style="  width: 370px;"></textarea>\n' +
                '                                                                </div>\n' +
                '\n' +
                '\n' +
                '                                                            </div>';

            $(this).before(template);
            if ($(".deluplod").length > 1) {
                $(".deluplod").css("display", "inline");
            }
            if ($(".imagetxts").length == 5) {
                $(this).hide();
            }
        }

    });
    // 上传图片
    $(".brand_item").delegate('.upImage', "click", function() {
        var $parent = $(this).closest(".imagetxts");
        var $file = $parent.find(".imageTxtFile");
        $file.click();
        console.log(22,$file);
    });
    // 删除
    $(".brand_item").delegate('.deluplod', "click", function(event) {
        $(this).closest(".imagetxts").remove();
        if ($(".deluplod").length == 1) {
            $(".deluplod").hide();
        } else {
            $(".deluplod").css("display", "inline");
        }
        if ($(".imagetxts").length < 5) {
            $(".addImageTxt").show();
        }
        event.stopPropagation();
    });

    // 图片上传
    $(".brand_item").delegate('.imageTxtFile', "change", function() {
        var $parent = $(this).closest(".imagetxts");
        var index = $parent.attr("data-index");
        var formData = new FormData();
        var file = "file";
        formData.append('file', $(this)[0].files[0]);
        formData.append('other',file);

        console.log(123);
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,

        }).done(function (res) {
            console.log(res);
            $parent.find(".deluplod").show();
            $parent.find(".imageShow").parent().show();
            $parent.find(".imageShow").attr("src", res.pic);
            $parent.find(".upImage").hide();
            if (res.code == 0) {
                $parent.find(".wechatImage").val(res.pic);
                $parent.find(".image").val(res.pic);
            } else {
                layer.msg('图片上传失败');
                imgRemoveStyle($parent);
            }
        }).fail(function (res) {
            alert("上传失败")
        });
    });
    // 图片删除
    $(".upload-v-img").click(function(){

        $("#fimg").attr("style","display:none");
        $(".img").attr("src", "");
        $("#logopic-upload").val("");

        $(".fengmian_img_parent").addClass("hide");
    })

    // 图片删除
    $(".brand_item").delegate('.imgTxtDel', "click", function() {
        var $parent = $(this).closest(".imagetxts");
        console.log($parent);
        imgRemoveStyle($parent);
    });
    // 图片删除效果
    function imgRemoveStyle($parent) {
        $parent.find(".imageShow").attr("src", "");
        $parent.find(".imageShow").parent().hide();
        $parent.find(".wechatImage").val("");
        $parent.find(".image").val("");
        $parent.find(".imageTxtFile").val("");
        $parent.find(".upImage").show();
    }
    function uploads(file,name,id) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other',file);
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            $("."+file).attr("src",res.pic);
            $("#logopic-upload").val(res.pic);

            $("#"+id).attr("style","display:block");

            $(".fengmian_img_dom").attr("src",res.pic);
            $(".fengmian_img_parent").removeClass("hide");

        }).fail(function (res) {
            alert("上传失败")
        });
    }

</script>
<script>
    //执行一个laydate实例
    // var s=laydate.now();
    laydate.render({
        elem: '#end_timestamp',
        type: 'datetime',
        range: false

    });
</script>
</html>
